#import sda
import scipy.io.wavfile as wav
#from PIL import Image

#data_dir = pjoin(dirname(sio.__file__), 'tests', 'data')
#wav_fname = pjoin(data_dir, 'test-44100Hz-2ch-32bit-float-be.wav')
#samplerate, data = sio.wavfile.read("audio1.wav")
fs, audio_clip = wav.read("example/audio.wav")
#print(f"number of channels = {audio_clip.shape[1]}")
print(f"number of channels = {audio_clip.shape}")
print(f"fs = {fs}")
print(f"audio_clip = {audio_clip}")
length = audio_clip.shape[0] / fs
print(f"length = {length}s")

import matplotlib.pyplot as plt
import numpy as np
time = np.linspace(0., length, audio_clip.shape[0])
plt.plot(time, audio_clip[:, 0], label="Left channel")
plt.plot(time, audio_clip[:, 1], label="Right channel")
plt.legend()
plt.xlabel("Time [s]")
plt.ylabel("Amplitude")
plt.show()
